<?php

/*
Edit Random Events (admin_edit_events.php)
*/

$page_title = "Edit Random Events";
$rank_check = 7;
include "../header.inc.php";

print "$openHTML";

$showEvent = fetch("SELECT * FROM random_events WHERE game = '$game'");
if (!$showEvent[id])
{
	mysql_query("INSERT INTO random_events (game) VALUES ('$game')");
	$showEvent = fetch("SELECT * FROM random_events WHERE game = '$game'");
}

if ($type == "points") { $showEvent = $showEvent[point_event]; $odds = "1:300"; }
if ($type == "cheap_item") { $showEvent = $showEvent[cheap_item_event]; $odds = "1:450"; }
if ($type == "rare_item") { $showEvent = $showEvent[rare_item_event]; $odds = "1:5000"; }
if ($type == "talking") { $showEvent = $showEvent[talking_event]; $odds = "1:450"; }

ECHO <<<END

<p align=center><font size=+2><a href=setup_events.php?game=$game>Read this before setting up the events!</a></font></p>

<P><FORM ACTION="admin_edit_events.pro.php?game=$game&type=$type" METHOD=POST>
   <CENTER><TABLE BGCOLOR="$tableOutline" CELLSPACING=1 CELLPADDING=0 WIDTH=450>
      <TR BGCOLOR="$topAndBottomBG">
         <TD COLSPAN=2 HEIGHT=50>
            <CENTER><FONT SIZE="+2" COLOR="$topAndBottomText">--Edit Random Event--</FONT></CENTER>
         </TD>
      </TR>
      <TR BGCOLOR="$topAndBottomBG">
         <TD WIDTH=80 HEIGHT=40>
            <P>Event:<br>(Odds: $odds)</P>
         </TD>
         <TD HEIGHT=40>
            <P><FONT SIZE="-1">&nbsp;<TEXTAREA NAME="edit_event" ROWS=7 COLS=65 WRAP=virtual>$showEvent</TEXTAREA></FONT></P>
         </TD>
      </TR>
      <TR>
         <TD COLSPAN=2 HEIGHT=30 BGCOLOR="$topAndBottomBG">
            <CENTER><FONT SIZE="-1" COLOR="$topAndBottomText"><I><INPUT TYPE=submit NAME=Submit VALUE="Edit Events!!"></I></FONT></CENTER>
         </TD>
      </TR>
   </TABLE>
   </CENTER>
</FORM></P>
END;

print "$closeHTML";
?>
